<?php

use think\migration\Migrator;
use think\migration\db\Column;

class PostCategory extends Migrator
{
    /**
     * Change Method.
     *
     * Write your reversible migrations using this method.
     *
     * More information on writing migrations is available here:
     * http://docs.phinx.org/en/latest/migrations.html#the-abstractmigration-class
     *
     * The following commands can be used in this method and Phinx will
     * automatically reverse them when rolling back:
     *
     *    createTable
     *    renameTable
     *    addColumn
     *    renameColumn
     *    addIndex
     *    addForeignKey
     *
     * Remember to call "create()" or "update()" and NOT "save()" when working
     * with the Table class.
     */
    public function change()
    {
        $this->table('post_category',['comment'=>'博客文章分类','engine' => 'MyISAM'])
            ->addColumn("parent_id",'integer',['comment'=>'父类id','signed'=>false])
            ->addColumn('name','string',['limit'=>30,'comment'=>'名称'])
            ->addColumn('desc','string',['limit'=>50,'comment'=>'简介','null'=>true])
            ->addColumn('created_at','integer',['signed'=>false,'comment'=>'创建时间'])
            ->addColumn('updated_at','integer',['signed'=>false,'comment'=>'修改时间'])
            ->addColumn('status','integer',['comment'=>'状态','limit'=>\Phinx\Db\Adapter\MysqlAdapter::INT_TINY])
            ->create();
    }
}
